﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace WindowsFormsApplication1
{
    class CheckValiDate
    {
        private long mathanhvien;
        private string username;
        private string password;
        private DateTime ngaysinh;
        private string lop;
        private string truong;
        private string email;
        private long masach;
        private string tensach;
        private int namxuatban;
        private string nhaxuatban;
        private long matacgia;
        private string tentacgia;
        private string chucvu;

        bool checkUserName(string username)
        {
            if (Regex.IsMatch(username, "[a-zA-z0-9]"))
                return true;
            else return false;
        }

        bool checkPassWord(string password)
        {
            if (Regex.IsMatch(password, "[a-zA-z0-9]{6}"))
                return true;
            else return false;
        }

        bool checkMaThanhVien(long mathanhvien)
        {
            String mtv = mathanhvien.ToString();
            if (Regex.IsMatch(mtv, "[0-9]{4}"))
                return true;
            else return false;
        }

        bool checkNgaySinh(DateTime ngaysinh)
        {
            return true;
        }

        bool checkLop(string lop)
        {
            if(Regex.IsMatch(lop, "[0-9a-zA-Z]"))
            return true;
            else return false;
        }

        bool checkTruong(string truong)
        {
            if(Regex.IsMatch(truong, "[0-9a-zA-Z]"))
            return true;
            else return false;
        }

        bool checkEmail(string email)
        {
            if(Regex.IsMatch(tensach, @"^(\w+@\w+\.\w+)$"))
              return true;
            else return false;
        }

        bool checkMaSach(long masach)
        {
            String ms = masach.ToString();
            if(Regex.IsMatch(ms, "[0-9]"))
            return true;
            else return false;
        }
        bool checkTenSach(string tensach)
        {
            if(Regex.IsMatch(tensach, "[0-9a-zA-Z]"))
            return true;
            else return false;
        }

        bool checkNamXuatBan(int namxuatban)
        {
            String nxb = namxuatban.ToString();
            if(Regex.IsMatch(nxb, "[0-9]"))
            return true;
            else return false;
        }

        bool checkNhaXuatBan(string nhaxuatban)
        {
            if(Regex.IsMatch(nhaxuatban, "[0-9a-zA-Z]"))
            return true;
            else return false;
        }

        bool checkMaTacGia(long matacgia)
        {
            String mtg = matacgia.ToString();
            if(Regex.IsMatch(mtg, "[0-9]"))
            return true;
            else return false;
        }

        bool checkTenTacGia(string tentacgia)
        {
            if(Regex.IsMatch(tentacgia, "[a-zA-Z]"))
            return true;
            else return false;
        }

        bool checkChucVu(string chucvu)
        {
            if(Regex.IsMatch(chucvu, "[a-zA-Z]"))
            return true;
            else return false;
        }

    }
    
}
